package com.sgj.gulimall.product.vo;

import com.sgj.gulimall.product.entity.SkuImagesEntity;
import com.sgj.gulimall.product.entity.SkuInfoEntity;
import com.sgj.gulimall.product.entity.SpuInfoDescEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author: Guoji Shen
 * @Date: 2021/8/30 16:25
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SkuItemVo {

    /**
     * sku 基本信息
     */
    private SkuInfoEntity info;

    /**
     * 是否有货
     */
    private boolean hasStock = true;

    /**
     * sku 图片信息
     */
    private List<SkuImagesEntity> images;

    /**
     * spu 销售属性组合
     */
    private List<SkuItemSaleAttrVo> saleAttrs;

    /**
     * spu 介绍信息
     */
    private SpuInfoDescEntity desc;

    /**
     * spu 规格参数信息
     */
    private List<SpuItemAttrGroupVo> groupAttrs;


    @Data
    public static class SkuItemSaleAttrVo {

        /**
         * 属性Id
         */
        private Long attrId;

        /**
         * 属性名
         */
        private String attrName;

        /**
         * 属性值
         */
        private List<AttrValueWithSkuIdVo> attrValues;
    }

    @Data
    public static class SpuItemAttrGroupVo {

        /**
         * 组名
         */
        private String groupName;

        /**
         * 基本属性
         */
        private List<SpuBaseAttrVo> attrs;
    }

    @Data
    public static class SpuBaseAttrVo {

        /**
         * 属性名
         */
        private String attrName;

        /**
         * 属性值
         */
        private String attrValue;
    }

    @Data
    public static class AttrValueWithSkuIdVo {

        /**
         * skuId
         */
        private String skuIds;

        /**
         * 属性值
         */
        private String attrValue;
    }

}